-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Search registries with an empty query #1444
Conversation
bot, retest this please |
db944ca
to
8c6da76
Compare
cmd/podman/search.go
Outdated
@@ -345,6 +345,9 @@ func matchesOfficialFilter(filter searchFilterParams, result docker.SearchResult | |||
} | |||
|
|||
func getRegistry(image string) (string, error) { | |||
if image[len(image)-1] == '/' { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe use strings.HasSuffix and strings.TrimSuffix here to be absolutely clear what's going on?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed! Fixed
LGTM |
bot, retest this please |
1 similar comment
bot, retest this please |
Tests are finally green! |
docs/podman-search.1.md
Outdated
@@ -13,7 +13,9 @@ The user can specify which registry to search by prefixing the registry in the s | |||
**registires.search** table in the config file - **/etc/containers/registries.conf**. | |||
The number of results can be limited using the **--limit** flag. If more than one registry | |||
is being searched, the limit will be applied to each registry. The output can be filtered | |||
using the **--filter** flag. | |||
using the **--filter** flag. To get all available images in a registry without a specific | |||
query, the user can just enter the registry name with a trailing (example **registry.fedoraproject.org/**). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with a trailing ? I think you want '/' or "slash" here..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
docs/podman-search.1.md
Outdated
using the **--filter** flag. | ||
using the **--filter** flag. To get all available images in a registry without a specific | ||
query, the user can just enter the registry name with a trailing (example **registry.fedoraproject.org/**). | ||
Note, searching without a query will only work for registries that implement the v2 API. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Down below you say the search only works for v2, but here you're saying it works for v1, but only the query works on v2? I'm a bit confused.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reworded a bit.
docs/podman-search.1.md
Outdated
@@ -13,7 +13,9 @@ The user can specify which registry to search by prefixing the registry in the s | |||
**registires.search** table in the config file - **/etc/containers/registries.conf**. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
registries.search not registires.search
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
docs/podman-search.1.md
Outdated
@@ -13,7 +13,9 @@ The user can specify which registry to search by prefixing the registry in the s | |||
**registires.search** table in the config file - **/etc/containers/registries.conf**. | |||
The number of results can be limited using the **--limit** flag. If more than one registry | |||
is being searched, the limit will be applied to each registry. The output can be filtered | |||
using the **--filter** flag. | |||
using the **--filter** flag. To get all available images in a registry without a specific | |||
query, the user can just enter the registry name with a trailing (example **registry.fedoraproject.org/**). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK you mention query here, but I don't see query prior. In the command synopsis term is mentioned but no reference to what that is here. Should term be changed to query?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I think I got it. a query would look like registry.fedoraproject.org/fedora vs registry.fedoraproject.org. Are there any wild cards allowed? i.e. registry.fedoraproject.org/f* to get all the images that start with f? Might be nice to expound on that and/or have an example or two. Also 'term' in the synopsis isn't explained anywhere and I think you're allowing multiple registries to be handed in no? I don't recall the syntax, but if multiples are allowed I think that needs to change to something like [term, ...] but would have to look it up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No we don't allow multiple registries to be handed in. If you just do podman search image
then it will try all the registries from your registries.conf file. If you do podman search docker.io/image
it will only search docker.io for image. And now if you do podman search myregistry/
, it will return all the images it finds in the registry if it is a v2 registry.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer the vendoring to be done in a separate PR as I don't think this PR depends on it, but shrug.
☔ The latest upstream changes (presumably facab2a) made this pull request unmergeable. Please resolve the merge conflicts. |
Picks up changes made to authentication for registry search. Signed-off-by: Urvashi Mohnani <umohnani@redhat.com>
Adds functionality to search registries implementing the v2 endpoint with an empty query, that is the results will be all the available images on the registries. If this is tried with a v1 registry an error will occur. To search a whole registry, there needs to be a trailing slash at the end, i.e `podman search registry.fedoraproject.org/`. Signed-off-by: Urvashi Mohnani <umohnani@redhat.com>
@TomSweeneyRedHat the vendor is important here as it implements the |
bot, retest this please |
📌 Commit bbcfa3b has been approved by |
⚡ Test exempted: pull fully rebased and already tested. |
Adds functionality to search registries implementing the v2 endpoint with an empty query, that is the results will be all the available images on the registries. If this is tried with a v1 registry an error will occur. To search a whole registry, there needs to be a trailing slash at the end, i.e `podman search registry.fedoraproject.org/`. Signed-off-by: Urvashi Mohnani <umohnani@redhat.com> Closes: #1444 Approved by: rhatdan
@umohnani8 thanks for the revisions, I like what you did! 👍 |
Adds functionality to search registries implementing the v2
endpoint with an empty query, that is the results will be
all the available images on the registries.
If this is tried with a v1 registry an error will occur.
To search a whole registry, there needs to be a trailing slash
at the end, i.e
podman search registry.fedoraproject.org/
.Fixes #1203
Signed-off-by: Urvashi Mohnani umohnani@redhat.com